<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Poet extends Model {
    //
    protected $table = 'poet';


    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'link'
    ];


    /**
     *
     * 查询作者列表
     *
     * @param null $author
     * @param int $offset
     * @param int $size
     * @return mixed
     */
    public static function getAuthor($author = null, $offset = 0, $size = 200) {
        if (is_null($author)) {
            return Poet::skip($offset)->take($size)->get();
        } else {
            return Poet::where('name', '=', $author)->get();
        }
    }

}
